﻿
var user_id;
$.ajaxHandler({
    url: "/tadongserviceweb/AjaxMappingHandler.aspx",
    urlType: "GetCurrentUser",
    success: function (data) {
        if (data) {
            user_id = data.USER_ID;

        }
    }
});

var mymanateam = {
    gridDefine: {
        columns: [
            { display: lang.Workgroup_name, name: 'TEAM_NAME', minWidth: 200 },
            //{ display: '负责人', name: 'TEAM_LEADER', minWidth: 90 },
            {display: lang.Project_build_unit, name: 'ROLES_ID', minWidth: 110 },
            { display: lang.Project_level, name: 'PRO_LEVEL_STR', minWidth: 140 },
            { display: lang.zone_state, name: 'TEAM_STS', minWidth: 60, render: LinkTEAM_STS },
            { display: lang.Project_state, name: 'PRO_STS', minWidth: 60, render: LinkPRO_STS },
            { display: lang.Start_date, name: 'START_DATE', minWidth: 70, render: LinkTEAM_STAR_DATE },
            { display: lang.End_date, name: 'END_DATE', minWidth: 70, render: LinkTEAM_END_DATE },
            { display: lang.operation, name: 'HEL_CONTR', minWidth: 100, render: LinkOP, align: 'center' }
        ],
      
        url: App_Config.TadongUrl + "/AjaxMappingHandler.aspx",
        urlType: "QueryMyManaTeamList"
    },
    init: function () {
        jsPageRender(this, true);
    },
    search: function () {
        jsPageSearch(this);
    }
}


function LinkOP(value, row, index) {
    var _str = 'teamid=' + row.TEAM_ID;
    return '<a href="javascript:void(0)" onclick="openPage(\'userselect\',\'' + _str + '\');">' + lang.User_management + '</a> <a href="javascript:void(0)" onclick="openPage(\'dataAdminUserSelect\',\'' + _str + '\');">' + lang.data_admin + '</a>';
}
function LinkTEAM_STS(value, row, index) {
    if (row.TEAM_STS == '1') { return lang.open; }
    else {
        return lang.close;
    }
}
function LinkPRO_STS(value, row, index) {
    if (row.TEAM_STS == '1') { return lang.Have_been_accepted; }
    else {
        return lang.Have_no_accepted;
    }
}
function LinkTEAM_STAR_DATE(value, row, index) {
    var dates = (String)(row.START_DATE);
    dates = dates.substring(0, 10);
    return dates;
}
function LinkTEAM_END_DATE(value, row, index) {
    var dates = (String)(row.END_DATE);
    dates = dates.substring(0, 10);
    return dates;
}

//#region 删除
function deleteteam(teamid, teamname) {
    $.extend($.messager.defaults, {
        ok: lang.ok,
        cancel: lang.cancel
    });
    $.confirm(lang.Are_you_sure_to_delete_the_current_team + "[" + teamname + "]", lang.Delete_project, function (b) {
        if (b) {
            $.ajaxHandler({
                url: App_Config.TadongUrl + "/AjaxMappingHandler.aspx",
                urlType: "DeleteTeamInfo",
                model: function () { return teamid; },
                success: function (data) {
                    $.alert(lang.Successfully_deleted, null, function () {
                        teamlist.search();
                    });
                }
            });
        }
    });
}